<%-- 
    Document   : AccountDetail
    Created on : 14/Jan/2010, 0:42:38
    Author     : Marco
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${requestScope['title']} - ${requestScope['action']}</title>
        <style type="text/css">
            body { font-family: Verdana, sans-serif; font-size:80%}
            table {
                border-color:black;
                border-style:solid;
                border-width:thin;
                padding:0;
                margin:0;
            }
            tr.l1 {
                background:lightblue;
                padding:0;
                margin:0;
            }
            tr.l2 {
                padding:0;
                margin:0;
            }
        </style>
    </head>
    <body>
        <h1>${requestScope['title']} - ${requestScope['action']}</h1>
        <form action="?action=${requestScope['formMethod']}" method="POST">
            <c:choose>
                <c:when test="${!empty requestScope['client']}">
                    <input type="hidden" name="clientId" value="${requestScope['client'].id}" />
                </c:when>
            </c:choose>
            <c:choose>
                <c:when test="${!empty requestScope['account']}">
                    <input type="hidden" name="accountId" value="${requestScope['account'].id}" />
                </c:when>
            </c:choose>
            <table>
                <tbody>
                    <tr>
                        <td colspan="2">Cliente</td>
                    </tr>
                    <tr>
                        <td>Nome :</td>
                        <td><input type="text" value="${requestScope['client'].name}" disabled /></td>
                    </tr>
                    <tr>
                        <td>NIF/NIPC :</td>
                        <td><input type="text" value="${requestScope['client'].nif}" disabled /></td>
                    </tr>
                    <tr>
                        <td colspan="2">Conta</td>
                    </tr>
                    <tr>
                        <td>Código Balcão :</td>
                        <td><input type="text" name="agency" value="${requestScope['account'].agency}" maxlength="4" ${requestScope['editable']} /></td>
                    </tr>
                <c:choose>
                    <c:when test="${requestScope['formMethod'] != 'save'}">
                        <tr>
                            <td>Número conta :</td>
                            <td><input type="text" value="${requestScope['account'].number}" disabled /></td>
                        </tr>
                        <tr>
                            <td>N.I.B. :</td>
                            <td><input type="text" value="${requestScope['account'].nib}" disabled /></td>
                        </tr>
                    </c:when>
                </c:choose>
                <tr>
                    <td>Plafom (Limite) :</td>
                    <td><input type="text" name="overBalance" value="${requestScope['account'].overBalance}" maxlength="10" ${requestScope['editable']}/> &euro;</td>
                </tr>
                <c:choose>
                    <c:when test="${requestScope['formMethod'] != 'save'}">
                        <tr>
                            <td>Saldo Disponivel :</td>
                            <td><input type="text" value="${requestScope['account'].availableBalance}" disabled /> &euro;</td>
                        </tr>
                        <tr>
                            <td>Saldo Contabilistico :</td>
                            <td><input type="text" value="${requestScope['account'].accountingBalance}" disabled /> &euro;</td>
                        </tr>
                    </c:when>
                </c:choose>
                <tr>
                <c:choose>
                    <c:when test="${requestScope['formMethod'] == 'save' || requestScope['formMethod'] == 'update'}">
                        <td><input type="submit" value="Gravar" /></td>
                        <c:choose>
                            <c:when test="${requestScope['formMethod'] == 'update'}">
                                <td><input type="button" value="Cancelar" onclick="this.form.action='?action=detail'; this.form.submit();"/></td>
                            </c:when>
                            <c:otherwise>
                                <td><input type="button" value="Cancelar" onclick="this.form.action='client?action=detail'; this.form.submit();"/></td>
                            </c:otherwise>
                        </c:choose>
                    </c:when>
                    <c:otherwise>
                        <td><input type="button" value="Editar" onclick="this.form.action='?action=edit'; this.form.submit();"/></td>
                        <td><input type="button" value="Voltar" onclick="this.form.action='client?action=detail'; this.form.submit();"/></td>
                    </c:otherwise>
                </c:choose>
                </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>
